package model.session;


/**
 * Describe the status of a execution of a preprocessor/solver Execution
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public enum ExecutionStatus {
	READY ("READY"), FINISH ("FINISH"), PROBLEM ("PROBLEM"), RUNNING ("RUNNING");

	private String	xmlValue;


	private ExecutionStatus(String xmlValue) {
		this.xmlValue = xmlValue;
	}

	/**
	 * Return the xmlValue, value that is supposed to written in the xml exportation.
	 * 
	 * @return the xmlValue
	 */
	public String getXmlValue() {
		return xmlValue;
	}

	/**
	 * Return the {@link ExecutionStatus} associate to a value find in a XML exportation.
	 * 
	 * @param value
	 *            xml value
	 * @return the associate {@link ExecutionStatus}
	 */
	public static ExecutionStatus getValueFromXML(String value) {
		for (ExecutionStatus val : values())
			if (val.getXmlValue().equals(value))
				return val;
		return null;
	}
}
